      var tmp=[];
  var splits=[];
    $(document).ready(function () {
        var optionMap = {
                 backgroundColor:'',
                title: {
                    text: '全国疫情分布图',
                    textStyle:{
                     color:'#5ac8fa'},
                    subtext: '',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item'
                },

                //左侧小导航图标
                visualMap: {
                    show : true,
                    x: 'left',
                    y: 'bottom',
                    splitList: [{start: 500, end:600},{start: 400, end: 500},
                        {start: 300, end: 400},{start: 200, end: 300},
                        {start: 100, end: 200},{start: 0, end: 100}],
                    color: ['#5475f5', '#9feaa5', '#85daef','#74e2ca', '#e6ac53', '#9fb5ea']
                },

                //配置属性
                series: [{
                    name: '数据',
                    type: 'map',
                    mapType: 'china',
                    roam: true,
                    label: {
                        normal: {
                            show: true  //省份名称
                            ,textStyle: {
                                fontSize: 10,
                                color: 'blue'
                            }
                        },
                        emphasis: {
                            show: false
                        }
                    },
                    data:[]  //数据
                }]
            };
        //初始化echarts实例
        var myChart = echarts.init(document.getElementById('map_a'));

        //使用制定的配置项和数据显示图表
        myChart.setOption(optionMap);
        myChart.showLoading();

        $.ajax({
            url:"/data_city"
            ,async:true
            ,dataType:'JSON'
            ,timeout:10000
            ,contentType:"application/json"
            ,success:function (data) {
                for (var i=0;i<data.length;i++){
                    tmp.push(
                        {name:data[i].name,value:data[i].value}
                    );
                    splits=[
                        {start:data[0].value/20,end:data[0].value},
                        {start:data[0].value/40,end:data[0].value/20},
                        {start:data[0].value/60,end:data[0].value/40},
                        {start:data[0].value/80,end:data[0].value/60},
                        {start:data[0].value/120,end:data[0].value/80},
                        {start:0,end:data[0].value/120},
                    ]
                    myChart.hideLoading();
                    myChart.setOption({
                        visualMap:{
                            splitList:splits
                        },
                        series: {
                            data:tmp
                        }
                    })
                }


            }

        });


    });
